package com.dwx.gmall.product.controller;

import ch.qos.logback.classic.pattern.LineOfCallerConverter;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dwx.gmall.common.result.Result;
import com.dwx.gmall.model.product.SpuImage;
import com.dwx.gmall.product.service.SpuImageService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/product")
public class SpuImageController {
    @Autowired
    SpuImageService spuImageService;
    @GetMapping("/spuImageList/{spuId}")
    public Result<List<SpuImage>> spuImageList(@PathVariable("spuId") Long spuId){
        QueryWrapper<SpuImage> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("spu_id",spuId);
        List<SpuImage> list = spuImageService.list(queryWrapper);
        return Result.ok(list);
    }
}
